<template>
  <div class="mine-box">
    <van-nav-bar
            title="我的"
            left-text=""
            left-arrow
    @click-left="onClickLeft"
    class="nav-bar"
    />
      <van-cell-group class="gap-s">
        <van-cell title="我的ID" :value="userid"  class="shadow" />
        <van-cell title="当前账户" :value="1"  class="shadow" />
        <van-cell title="用户级别" :value="userObj.rating"  class="shadow" />
        <van-cell title="信用度" :value="userObj.credit_rate"  class="shadow" />
        <van-cell title="奖池排名" :value="userObj.tk_pool_rating"  class="shadow" />
        <van-cell title="USDT地址" :value="userObj.tc_address"  class="shadow" />
        <!--<van-cell title="支付宝密码" :value="1"  class="shadow" />-->
        <!--<van-cell title="用户反馈" :value="1"  class="shadow" />-->
        <van-cell title="在线客户" :value="userObj.helpdesk"  class="shadow" />
        <van-cell title="联系我们" :value="userObj.contact_us"  class="shadow" />
      </van-cell-group>


    <van-tabbar class="new-bo-nav" style="z-index:9999;height: 62px;background: #000;">
      <van-tabbar-item>
        <router-link :to="{ path: '/game' }" exact>首页</router-link>

      </van-tabbar-item>
      <van-tabbar-item>
        <router-link :to="{ path: '/wallet' }">钱包</router-link>

      </van-tabbar-item>

      <van-tabbar-item>
        <router-link :to="{ path: '/my' }">我的</router-link>
      </van-tabbar-item>
    </van-tabbar>
    </div>
</template>

<script>
  import { Toast } from 'vant';
  import { Dialog } from 'vant';
  export default {
    data(){
      return {
        showChangeName: false,
          showChangePhone:false,
        showImgChoose: false,
        myCroppa: {},
        config: {
            value: 'https://www.baidu.com',
            imagePath: './examples/assets/logo.png',
            filter: 'color'
        },
        erweimaControl:true,
        islogin:false,
        downloadButton: false,
        //  用户账l号信息
        accountList: [],

        //用户号码
        hideNum:null,

        //  绑定微信授权flag
        bindIndex: false,

        bindTitle:'待绑定',
        // 用户头像
        userAvatar:'',
        //  版本参数
        param_uuid:null,

        param_scource:null,

        nickname:"",
        usermobile:"",
        imgsrc:"",
        userid:"",
          userObj:{},
      }
    },
    created(){

    },
    mounted(){
      if(!sessionStorage.getItem("usermessage")) {
        this.$router.push('/login');
      }
      token_g = JSON.parse(sessionStorage.getItem("usermessage")).token;
      this.userid = JSON.parse(sessionStorage.getItem("usermessage")).user.id;
      this.getMyUser();
    },
    methods:{
        onClickLeft() {
        this.$router.push('/index')
    },

        getMyUser() {
            console.log(token_g)
            if(!token_g) {
                Dialog.alert({
                    message: '请先登录'
                }).then(() => {
                    // on close
                });
                return false
            } else {
                // 头部信息
                this.$axios({
                    method: 'POST',
                    url: url_g + '/aboutme/',
                    headers: {
                        'Authorization': 'Bearer ' + token_g
                    }
                }).then((res) => {
                    console.log(res)
                    if(res.data) {
                    this.userObj = res.data.data
                }
            }).catch((e) => {
                    console.error('GET err:' + e);

            });
            }
        },

    }
  }
</script>

<style scoped>

</style>
